It turns out that we can do that now because we have an enzyme called reverse transcriptase, which is able to take single stranded messenger RNA and make DNA out of it.
It was a stretch of DNA that could be transcribed by an enzyme called polymerase into a chemically similar molecule known as RNA. The RNA acted as a messenger that was itself translated into protein molecules in sub-cellular factories called ribosomes.